package com.link2room.rodimus.entity;

import com.link2room.common.entity.BaseEntity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * Created by LN on 2017/7/24.10:33
 */
@Entity
@Table(name = "coupon_base")
public class CouponBaseEntity extends BaseEntity{
    private String code;
    private String rule;
    private String type;
    private String couponName;
    private String descript;
    private String presentValue;
    private BigDecimal salePrice;
    private BigDecimal costPrice;
    private String isSpecify;

    @Basic
    @Column(name = "code")
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "rule")
    public String getRule() {
        return rule;
    }

    public void setRule(String rule) {
        this.rule = rule;
    }

    @Basic
    @Column(name = "type")
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Basic
    @Column(name = "coupon_name")
    public String getCouponName() {
        return couponName;
    }

    public void setCouponName(String couponName) {
        this.couponName = couponName;
    }

    @Basic
    @Column(name = "descript")
    public String getDescript() {
        return descript;
    }

    public void setDescript(String descript) {
        this.descript = descript;
    }

    @Basic
    @Column(name = "present_value")
    public String getPresentValue() {
        return presentValue;
    }

    public void setPresentValue(String presentValue) {
        this.presentValue = presentValue;
    }

    @Basic
    @Column(name = "sale_price")
    public BigDecimal getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(BigDecimal salePrice) {
        this.salePrice = salePrice;
    }

    @Basic
    @Column(name = "cost_price")
    public BigDecimal getCostPrice() {
        return costPrice;
    }

    public void setCostPrice(BigDecimal costPrice) {
        this.costPrice = costPrice;
    }

    @Basic
    @Column(name = "is_specify")
    public String getIsSpecify() {
        return isSpecify;
    }

    public void setIsSpecify(String isSpecify) {
        this.isSpecify = isSpecify;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CouponBaseEntity that = (CouponBaseEntity) o;

        if (code != null ? !code.equals(that.code) : that.code != null) return false;
        if (rule != null ? !rule.equals(that.rule) : that.rule != null) return false;
        if (type != null ? !type.equals(that.type) : that.type != null) return false;
        if (couponName != null ? !couponName.equals(that.couponName) : that.couponName != null) return false;
        if (descript != null ? !descript.equals(that.descript) : that.descript != null) return false;
        if (presentValue != null ? !presentValue.equals(that.presentValue) : that.presentValue != null) return false;
        if (salePrice != null ? !salePrice.equals(that.salePrice) : that.salePrice != null) return false;
        if (costPrice != null ? !costPrice.equals(that.costPrice) : that.costPrice != null) return false;
        return isSpecify != null ? isSpecify.equals(that.isSpecify) : that.isSpecify == null;
    }

    @Override
    public int hashCode() {
        int result = code != null ? code.hashCode() : 0;
        result = 31 * result + (rule != null ? rule.hashCode() : 0);
        result = 31 * result + (type != null ? type.hashCode() : 0);
        result = 31 * result + (couponName != null ? couponName.hashCode() : 0);
        result = 31 * result + (descript != null ? descript.hashCode() : 0);
        result = 31 * result + (presentValue != null ? presentValue.hashCode() : 0);
        result = 31 * result + (salePrice != null ? salePrice.hashCode() : 0);
        result = 31 * result + (costPrice != null ? costPrice.hashCode() : 0);
        result = 31 * result + (isSpecify != null ? isSpecify.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "CouponBaseEntity{" +
                "code='" + code + '\'' +
                ", rule='" + rule + '\'' +
                ", type='" + type + '\'' +
                ", couponName='" + couponName + '\'' +
                ", descript='" + descript + '\'' +
                ", presentValue='" + presentValue + '\'' +
                ", salePrice=" + salePrice +
                ", costPrice=" + costPrice +
                ", isSpecify='" + isSpecify + '\'' +
                "} " + super.toString();
    }
}
